package com.online.service_oss.controller;

import com.online.common_utils.ResultJson;
import com.online.service_oss.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("service_oss/oss")
@CrossOrigin
public class OssController {

    @Autowired
    private OssService ossService;

    @PostMapping("uploadImage")
    public ResultJson uploadTeacherIm(MultipartFile file){
        String url=ossService.uploadOssFile(file);
        return ResultJson.ok().data("url",url);
    }
}
